package com.xiaochong.tir.common.data.vo;


import java.time.OffsetDateTime;



import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
/**
 * Created by Administrator on 2018/4/28.
 */
public class BaseEntity {

    protected Integer pageIndex;
    protected Integer pageSize;
    @JsonIgnore
    protected Integer limitStart;
    @JsonIgnore
    protected Integer limitEnd;
    protected String orderBy;
    @JsonIgnore
    protected String keyword;

    public Integer getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(Integer pageIndex) {
        this.pageIndex = pageIndex;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getLimitStart() {
        if (pageSize == null || pageSize <2) {
            pageSize=10;
        }
        if (pageIndex == null ||  pageIndex <= 0 ) {
            pageIndex=1;
        }
        limitStart =(pageIndex-1) * pageSize;
        return limitStart;
    }

    public void setLimitStart(Integer limitStart) {
        this.limitStart = limitStart;
    }

    public Integer getLimitEnd() {
        if (pageSize == null || pageSize <2) {
            pageSize=20;
        }
        if (pageIndex == null ||  pageIndex <= 0 ) {
            pageIndex=1;
        }
        limitEnd =pageSize;
        return limitEnd;
    }

    public void setLimitEnd(Integer limitEnd) {
        this.limitEnd = limitEnd;
    }

    public String getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }

    public String getKeyword() {
        return keyword;
    }

    public void setKeyword(String keyword) {
        this.keyword = keyword;
    }

}
